﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title></title>
    <link href="../CSS/style1.css" rel="stylesheet" type="text/css" />
    <link href="../CSS/style4.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.showModalDialog.js" type="text/javascript"></script>
    <script type="text/javascript">
        var ID = window.dialogArguments.id;

        $(function () {
            //通过id将资料从数据库中查询出来
            $.ajax({
                url: "QuanBuAll.asmx/FindCustomLosts",
                type: "post",
                data: JSON.stringify({ id: parseInt(ID) }),
                dataType: "json",
                contentType: "application/json",
                success: function (obj) {
                    $("#txt1").val(obj.d.CLReason) || ""
                }, error: function (xmlhttp) {
                    alert("错误：" + xmlhttp.responseText);
                }
            });

        })
        function ok() {
            //收集表单数据
            var M = {
                action: "UpdateCustomLosts",
                CLID: ID,
                CLReason: $("#txt1").val()
            };
            //发起更新请求
            $.get("LostsPage.ashx", M, function (r) {
                if (r == "1") {
                    alert("流失原因添加成功");
                    window.returnValue = true;
                    window.close();
                } else {
                    alert("添加失败");
                }
            });
        }

    </script>
</head>
<body>
      <table class="tableEdit" id="tb1">
        <thead>
            <tr>
                <td colspan="2">客户流失确认</td>
            </tr>
        </thead>
            <tr>
                <th>流失原因：</th>
                <td>
                    <textarea id="txt1" style="width:90%"></textarea>
                </td>
            </tr>
        <tfoot>
            <tr>
                <td colspan="4">
                    <input type="button" value="确定" onclick="ok()" />&nbsp;&nbsp;
                    <input type="button" value="取消" onclick="window.close()" />
                </td>
            </tr>
        </tfoot>
    </table>
</body>
</html>
